home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CMDLINE.SWG / 0008_Command parser.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  735b  |  25 lines

  1. {    Hey David, try this one out. It Uses a little known fact that TP
  2. will parse the command line each time you call Paramstr(). So by
  3. stuffing a String into the command-line buffer, we can have TP parse it
  4. For us.
  5. }
  6. Program Parse;
  7. Type
  8.     String127 = String[127];
  9.     Cmd = ^String127;
  10.  
  11. Var
  12.     My_String : Cmd;
  13.     Index : Integer;
  14.  
  15. begin
  16.     My_String := Ptr(PrefixSeg, $80); {Point it to command line buffer}
  17.     Write('Enter a line of Text (127 caracters Max) ');
  18.     Readln(My_String^);
  19.     For Index := 1 to Paramcount do
  20.         Writeln(Paramstr(Index));
  21. end.
  22.  
  23. {    You can solve the problem of the 127 caracter limit by reading into
  24. a standard String and splitting it into <127 caracter substrings.
  25. }